package com.java.comprehensive;

import cn.hutool.json.JSONObject;
import lombok.Data;

import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Consumer;

/**
 * @program: comprehensive-service
 *
 * @description:
 *
 * @author: 窦绍飞
 *
 * @create: 2021-12-01 13:45
 **/
public class ZhihuTest2 {

	private static Map<String, Consumer<String>> FUNC_MAP = new ConcurrentHashMap<>();
	private static String MAN = "man";
	private static String WOMAN = "woman";
	static {
		FUNC_MAP.put(MAN, person -> {
			System.out.println(person + "应该去男厕所");
		});
		FUNC_MAP.put(WOMAN, person -> {
			System.out.println(person + "应该去女厕所");
		});
	}

	@Data
	static class Person {
		private String gender;
		private String name;
	}

/*	public static void main(String[] args) {
		Person p = new Person();
		p.setGender(MAN);
		p.setName("张三");
		Person p2 = new Person();
		p2.setGender(WOMAN);
		p2.setName("张三他老婆");

		FUNC_MAP.get(p.getGender()).accept(p.name);
		FUNC_MAP.get(p2.getGender()).accept(p2.name);

	}*/

	// 输出：
	// 张三应该去男厕所
	// 张三他老婆应该去女厕所

	public static void main(String[] args) throws IOException {
		WeChatMsgSend weChatMsgSend = new WeChatMsgSend();
		JSONObject jsonObject = new JSONObject();
		jsonObject.set("mobile", "15093730188");
		String token = "hmhEeTe_-5DbD_RH7RQSuoh8kbPo0gr36SnaEBGF3oVEFLNEhNLetDv8GV7SAP_s1MBGfIqFoMNaSl5Etr7cXewGRzWP3IfqO5QBQvDw6p_2kXpZHDcneYUPhEr6frAmR3uOyNItg4Zy9ARSkebcsIMcoM2S1EKLQ_eb28EKSboFAy5L3XgRi4ygS9cv6O4tCU3f-kLBTwbhgeyi3Zvt6A";
		String post = weChatMsgSend.post("utf-8", "application/json", "https://qyapi.weixin.qq.com/cgi-bin/user/getuserid", jsonObject.toString(), token);
		System.out.println(post);
	}
}
